﻿@{
    Layout = "~/Areas/Web/Views/Shared/_UserCenter.cshtml";
    ViewBag.Title = "退换货明细";
}
@using Himall.Core;
@using Himall.Model;
@model  Himall.Model.OrderRefundInfo

@{
    //是否弃货
    bool isDiscard = false;
    if (Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited
        && Model.BuyerDeliverDate == null
        && Model.RefundMode != OrderRefundInfo.OrderRefundMode.OrderRefund
        && Model.IsReturn == true
        )
    {
        isDiscard = true;
    }
    //是否拒绝
    bool isUnAudit = (Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.UnAudit);
    //是否退货
    bool isReturnGoods = (Model.RefundMode == OrderRefundInfo.OrderRefundMode.ReturnGoodsRefund);

    int curstep = 1;
    string curshowcls = "todo";
}

<div class="box1 lh24">
    <div class="title bot-border">
        <h3 class="title_txt cur">退货记录详情</h3>
    </div>
    <div class="mod lh24">
        <div class="smt-01">售后服务进度条<span class="remind-box">（服务单号：@Model.Id）</span></div>
        <div class="smc-01">

            <div class="step-list">
                <div class="step-u done">
                    <em>@(curstep)</em>
                    买家申请售后
                    <span class="tail tail2"></span>
                    <span class="tail"></span>
                </div>
                @{
                    curstep++;
                    curshowcls = "done";
                    if (Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.WaitAudit)
                    {
                        curshowcls = "active";
                    }
                }
                <div class="step-u @(curshowcls)">
                    <em>@(curstep)</em>
                    商家审核申请
                    <span class="tail tail2"></span>
                    <span class="tail"></span>
                </div>
                @if (isUnAudit)
                {
                    curstep++;
                    <div class="step-u  done">
                        <em>@(curstep)</em>
                        商家拒绝申请
                    </div>
                }
                @if (Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited && isDiscard)
                {
                    curstep++;
                    <div class="step-u  done">
                        <em>@(curstep)</em>
                        商家选择弃货
                        <span class="tail tail2"></span>
                        <span class="tail"></span>
                    </div>
                }
                @if (isReturnGoods && !isDiscard && !isUnAudit)
                {
                    curstep ++;
                    {
                        curshowcls = "todo";
                        if ((int)Model.SellerAuditStatus > (int)OrderRefundInfo.OrderRefundAuditStatus.WaitDelivery && !isDiscard
                        && !isUnAudit)
                        {
                            curshowcls = "done";
                        }
                        if (curshowcls == "todo" && Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.WaitDelivery)
                        {
                            curshowcls = "active";
                        }
                    }
                    <div class="step-u  @(curshowcls)">
                        <em>@(curstep)</em>
                        买家回寄商品
                        <span class="tail tail2"></span>
                        <span class="tail"></span>
                    </div>
                }
                @if (isReturnGoods && !isDiscard && !isUnAudit)
                {
                    {
                        curstep++;
                        curshowcls = "todo";
                        if ((int)Model.SellerAuditStatus > (int)OrderRefundInfo.OrderRefundAuditStatus.WaitReceiving && !isDiscard
                        && Model.SellerAuditStatus != OrderRefundInfo.OrderRefundAuditStatus.UnAudit)
                        {
                            curshowcls = "done";
                        }
                        if (curshowcls == "todo" && Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.WaitReceiving)
                        {
                            curshowcls = "active";
                        }
                    }
                    <div class="step-u @(curshowcls)">
                        <em>@(curstep)</em>
                        商家确认收货
                        <span class="tail tail2"></span>
                        <span class="tail"></span>
                    </div>
                }
                @{
                    curstep++;
                    curshowcls = (Model.ManagerConfirmStatus == Himall.Model.OrderRefundInfo.OrderRefundConfirmStatus.Confirmed ? "done" : "todo");
                    if (Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited && curshowcls == "todo")
                    {
                        curshowcls = "active";
                    }
                }
                @if (!isUnAudit)
                {
                    <div class="step-u  @(curshowcls)">
                        <em>@(curstep)</em>
                        平台完成退款
                    </div>
                }
            </div>
        </div>
    </div>

    <div class="mod lh24">
        <h3 class="sub-title">服务单信息</h3>
        <div class="border-box" style=" border-top:1px solid #e4e4e4;">
            <table class="tb-void tb-cols">
                <colgroup>
                    <col width="160px" />
                    <col />
                </colgroup>
                <tbody>
                    <tr class="tr-td">
                        <td>退款金额</td>
                        <td class="ftx-04">@Model.Amount</td>
                    </tr>
                    @if (Model.IsReturn)
                    {
                        <tr class="tr-td">
                            <td>退货数量</td>
                            <td>@Model.OrderItemInfo.ReturnQuantity</td>
                        </tr>
                    }
                    <tr class="tr-td">
                        <td>退款方式</td>
                        <td>@(Model.RefundPayType==null?"线下处理":Model.RefundPayType.ToDescription())</td>
                    </tr>
                    <tr class="tr-td">
                        <td>退款理由</td>
                        <td>@Model.Reason.Replace("&nbsp;"," ")</td>
                    </tr>
                </tbody>

            </table>
        </div>
    </div>

    <div class="refund-remark mt20">
        <h5><b>进度说明：</b></h5>
    </div>

    <div class="mod lh24">
        <div class="border-box">
            <table class="tb-void tb-back">
                <colgroup>
                    <col width="150" />
                    <col width="400" />
                    <col width="120" />
                    <col width="160" />
                </colgroup>
                <thead>
                    <tr class="tr">
                        <th>处理时间</th>
                        <th>处理信息</th>
                        <th>操作人</th>
                        <th>备注</th>
                    </tr>
                </thead>
                <tbody>
                    @{
                        bool isFirstShow = true;
                    }
                    @if (Model.SellerAuditStatus == Himall.Model.OrderRefundInfo.OrderRefundAuditStatus.Audited)
                    {
                        <tr class="tr-td @(isFirstShow ? "tr-result" : "")">
                            <td><span>@Model.ManagerConfirmDate</span></td>
                            <td>@Model.ManagerConfirmStatus.ToDescription()</td>
                            <td><span>平台</span></td>
                            <td>@(Model.ManagerRemark)</td>
                        </tr>
                        isFirstShow = false;
                    }
                    @if (Model.SellerConfirmArrivalDate != null
                            && (int)Model.SellerAuditStatus > (int)OrderRefundInfo.OrderRefundAuditStatus.WaitReceiving
                            )
                    {
                        <tr class="tr-td @(isFirstShow ? "tr-result" : "")">
                            <td><span>@Model.SellerConfirmArrivalDate</span></td>
                            <td>商家确认收货</td>
                            <td><span>商家</span></td>
                            <td>&nbsp;</td>
                        </tr>
                        isFirstShow = false;
                    }
                    @if (Model.BuyerDeliverDate != null
                            && (int)Model.SellerAuditStatus > (int)OrderRefundInfo.OrderRefundAuditStatus.WaitDelivery
                            )
                    {
                        <tr class="tr-td @(isFirstShow ? "tr-result" : "")">
                            <td><span>@Model.BuyerDeliverDate</span></td>
                            <td>买家回寄商品</td>
                            <td><span>买家</span></td>
                            <td>
                                @(Model.ExpressCompanyName)
                                <br />
                                @(Model.ShipOrderNumber)
                            </td>
                        </tr>
                        isFirstShow = false;
                    }
                    @if (Model.SellerAuditStatus != OrderRefundInfo.OrderRefundAuditStatus.WaitAudit)
                    {
                        <tr class="tr-td @(isFirstShow ? "tr-result" : "")">
                            <td><span>@Model.SellerAuditDate</span></td>
                            <td>
                                @if (Model.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.UnAudit)
                                {
                                    @(Model.SellerAuditStatus.ToDescription())
                                }
                                else
                                {
                                    @("商家同意退款") @(isDiscard ? "并弃货" : "")
                                }
                            </td>
                            <td><span>商家</span></td>
                            <td>@(Model.SellerRemark)</td>
                        </tr>
                                isFirstShow = false;
                    }
                    <tr class="tr-td @(isFirstShow ? "tr-result" : "")">
                        <td><span>@Model.ApplyDate</span></td>
                        <td>您的服务单已申请成功，待商家审核中</td>
                        <td><span>系统</span></td>
                        <td>&nbsp;</td>
                    </tr>
                </tbody>



            </table>
        </div>
    </div>

</div>
